<?php
if ( !defined( "IN_OP" ) )
{
    exit( "You can't access this file directly..." );
}
if ( ( $curruser['acl'] < 255 || $curruser['acl'] == 255 && $curruser['prev_id'] != 0 ) && !SubAccountRight( $curruser, 1 ) )
{
    diemsg( "你不是管理者！" );
}
$ui = new UI();
$tpl = new Template2();
$conf = new Config();
$rs = getdb( "select * from lotto where open>='".date( "Y-m-d" )."' order by open" );
if ( $rs->eof )
{
    $ui->showErrorPage( "<p class=error>目前没有可以下注期数！</p>" );
    exit();
}
$open = $rs->f['open'];
$round = $rs->f['round'];
$lotto_id = $rs->f['id'];
$opnumber = $rs->f['n1'];
$rs->close();
$lists = "";
$total_win = 0;
$sql = "select * from bet8 where lotto_id=".$lotto_id." order by createtime desc, bettype, numbers";
$rst = getdb( $sql );
$movenext = !$rst->eof;
if ( $movenext )
{
    $total = 0;
    $wintot = 0;
    $backs = 0;
    $items = 0;
    while ( $movenext )
    {
        ++$items;
        $lists .= "<tr align=right class=td2 onmouseover=msover() onmouseout=msout() valign=top>";
        $lists .= "<td nowrap><font color=#217952>".$rst->f['id']."</font> &nbsp; ".date( "m-d H:i:s", $rst->f['createtime'] );
        $lotto = get_lotto( $rst->f['lotto_id'] );
        $lists .= "<td nowrap>".d3( $lotto->data['round'] )." 期 &nbsp; <font color=#217952>".$lotto->data['open']."</font>";
        $lists .= "<td nowrap>".GetBetContent( $rst->f['bettype'], $rst->f['numbers'], $rst->f['amount'] );
        $lists .= "<td nowrap>".show_rate( $rst->f['bettype'], $rst->f['rate'] - 0 );
        $lists .= "<td nowrap>".$rst->f['amount'];
        $lists .= "<td nowrap>".$rst->f['back'] * $rst->f['amount'] / 100;
        $lists .= "<td nowrap>".say_numbercolor( $rst->f['r5'] );
        $reme = "";
        if ( $rst->f['rame'] == 1 )
        {
            $reme = "逾时";
        }
        if ( $rst->f['rame'] == 2 )
        {
            $reme = "取消";
        }
        if ( $rst->f['rame'] == 3 )
        {
            $reme = "异常";
        }
        $lists .= "<td nowrap><font color='red'>".$reme."</font>";
        $lists .= "<td nowrap>".$rst->f['account']."</td>";
        if ( $rst->f['rame'] == 0 || $rst->f['rame'] == 9 )
        {
            $total += $rst->f['amount'];
            $backs += $rst->f['back'] * $rst->f['amount'] / 100;
            $wintot += $rst->f['r5'];
        }
        $rst->movenext();
        $movenext = !$rst->eof;
    }
    $lists .= "<tr class=td1><td colspan=4 align=right><b>合计 ".$items." 笔</b>";
    $lists .= "<td align=right nowrap><b>".$total."</b>";
    $lists .= "<td align=right nowrap><b>".$backs."</b>";
    $lists .= "<td align=right nowrap><b>".say_numbercolor( $wintot )."</b><td><td>";
    $lists .= "</table>";
}
$stopbet = $conf->get( "stopbet" );
$dt = date( "Y-m-d" );
$t1 = strtotime( $open." ".$stopbet );
$tpl->set( "round", d3( $round ) );
$tpl->set( "open", $open );
$tpl->Set( "timestap", $t1 - systime( ) );
$tpl->set( "phptime", systime( ) );
$tpl->set( "lists", $lists );
include_once( "class_6h/class.menu.php" );
$fieldArr = array( "round" => $round, "open" => $open, "lotto_id" => $lotto_id, "split_id" => 1 );
$onlineMenu = new menu_6h( 2, $fieldArr );
$selectid = getvar( "select" ) == "" ? 0 : getvar( "select" );
$menuList = $onlineMenu->getMenu( $selectid );
$tpl->set( "menuList", $menuList );
unset( $onlineMenu );
$tpl->load( "main", "unow6.htm" );
$tpl->set( "jslang", $g_conf['language'] );
$tpl->show( "main" );
$ui->footer();
?>